package com.production.CoursePlatform.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.production.CoursePlatform.entity.Teaching;

import java.util.List;

import com.production.CoursePlatform.mapper.TeachingMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class TeachingService {

    @Autowired
    private TeachingMapper teachingMapper;

    // 添加教学信息
    public int addTeaching(Teaching teaching) {
        // 不指定 `cID` 字段
        return teachingMapper.insertWithoutCID(teaching);
    }

    // 根据 ctID 删除教学信息
    public int deleteTeaching(int ctID) {
        return teachingMapper.deleteByCID(ctID);
    }

    // 更新教学信息
    public int updateTeaching(Teaching teaching) {
        return teachingMapper.updateTeaching(teaching);
    }

    // 根据 tID 查找教学信息
    public List<Teaching> getTeachingByTID(String tID) {
        return teachingMapper.findByTID(tID);
    }

    // 获取所有教学信息
    public List<Teaching> getAllTeachings() {
        return teachingMapper.selectList(null);
    }
}

